package cn.jyc.ssm03.service;

import cn.jyc.ssm03.dao.NewsMapper;
import cn.jyc.ssm03.pojo.News;
import cn.jyc.ssm03.utils.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsService {
    @Autowired
    private NewsMapper nm;

    public String getNews(){
        List<News> news = nm.getNews();
        return JsonUtil.objectToJson(news);
    }

    public String getNews2(){
        List<News> news = nm.getNews2();
        return JsonUtil.objectToJson(news);
    }
}
